<?php

require_once "include/config.php";
require_once "include/functions.php";

$mod_user_information = get_user_info();

$random_open_subtitles = get_random_open_subtitles('3');
//print_r($random_open_subtitles);

for ($i = 0; $i <= count($random_open_subtitles)-1; $i++) {
if($random_open_subtitles[$i]['is_favourite_video']=="1")
{
$video_info = get_favourite_video_information($random_open_subtitles[$i]['video_id']);
}
else
{
$video_info = get_video_information($random_open_subtitles[$i]['video_id']);
}
$video_title = $video_info['name'];
$video_desc = $video_info['desc'];
$video_id = $video_info['id'];
$image3 = $video_info['image3'];
$subtitle_video_type = $random_open_subtitles[$i]['is_favourite_video'];
$lang_name = get_language_by_id($random_open_subtitles[$i]['language']);
$lang_name = $lang_name['name'];

if($subtitle_video_type=='1'){$video_type='favourite';}else{$video_type='';}

//if(empty($video_id)){$video_id = "";}
//if(empty($video_type)){$video_type = "";}
//if(empty($image3)){$image3 = "";}
//if(empty($video_title)){$video_title = "";}

if(empty($subtitles_in_process)){$subtitles_in_process="";}

$subtitles_in_process = $subtitles_in_process . "
    <style>
    div.sipimg
    {
	border-color: #d3d3d3;
	border-style: solid ;
	border-width: 1px;
    padding: 3px;
    vertical-align: middle ;
    width: 194px;
    height: 146px;
	-moz-border-radius:3px;  /* for Firefox */
	-webkit-border-radius:3px; /* for Webkit-Browsers */
	border-radius:3px; /* regular */
    }
    </style>

<div class='modsiprow-container' style='width=:100%'>

<div class='modsip-image-container' style='float:left;'>
<div class='sipimg' style='float:left;'>
<a href='index.php?page=video_player&video_id=".$video_id."&video_type=".$video_type."'><img src='thumbnails/".$image3."' alt='".$video_title."' style='width:194px; height:146px;'></a>
</div>
</div>

<div class='modsip-data-container' style='float:left; margin-left:5px; width:55%;'>


<div style='float:left; overflow:auto;'><b>Subtitle:&nbsp;</b>
".$random_open_subtitles[$i]['title']."</div>


<div style='clear:left;'>
<div style='float:left; overflow:auto;'><b>Video:&nbsp;</b>
".$video_title."</div>
</div>

<div style='clear:left;'>
<div style='float:left; overflow:auto;'><b>Description:&nbsp;</b>
".substr($video_desc,0,150)."...</div>
</div>

<div style='clear:left;'>
<div style='float:left; overflow:auto;'><b>Language:&nbsp;</b>
".$lang_name."</div>
</div>

<div style='clear:left;'>
<div style='float:left;'>
<b>Done:</b>
".get_subtitle_progress($random_open_subtitles[$i]['table_name'])."%&nbsp;
</div>
<div class='progress-level' style='float:left; width:".get_subtitle_progress($random_open_subtitles[$i]['table_name'])."%;'></div>
</div>

<div style='clear:left;'>
<div style='float:left; overflow:auto;'><b>Join Team:</b>
";

if(is_user_loggedin()=="true")
{
$subtitles_in_process = $subtitles_in_process . "<a href='index.php?page=requests&user_id=".$mod_user_information['id']."&subtitle_id=".$random_open_subtitles[$i]['id']."&request=yes'>click here to join the subtitle team</a>";
}
else
{
$subtitles_in_process = $subtitles_in_process . "<a href='index.php?page=signin'>login</a>";
}

$subtitles_in_process = $subtitles_in_process . "
</div>
</div>


</div>


</div>

<div style='clear:both;'></div>
";

if ($i<count($random_open_subtitles)-1){$subtitles_in_process = $subtitles_in_process ."<hr>";}

}

?>

